package com.maxd.service.selfWXPay;

import com.maxd.model.PayRecord;
import com.wechat.pay.java.service.partnerpayments.jsapi.model.Transaction;
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;

import javax.servlet.http.HttpServletRequest;

/**
 * 微信支付V3文档
 */
public interface WxPayV3Service {
    /**
     * JSAPI/小程序下单并生成调起支付的参数 https://pay.weixin.qq.com/doc/v3/merchant/4012791856
     * @return
     */
    PrepayWithRequestPaymentResponse prepayJsapi(PayRecord payRecord);

    /**
     * 支付结果回调，参考https://pay.weixin.qq.com/doc/v3/merchant/4012791861
     * @param httpServletRequest
     * @return
     * @throws Exception
     */
    Transaction payNotice(HttpServletRequest httpServletRequest) throws Exception;

    JsapiServiceExtension initJsapiService(boolean reload);

    /**
     * 查询支付结果 参考https://pay.weixin.qq.com/doc/v3/merchant/4012791859
     * @param paySeq
     * @return
     */
    com.wechat.pay.java.service.payments.model.Transaction queryPayResult(String paySeq);

    /**
     * 微信支付关闭订单：https://pay.weixin.qq.com/doc/v3/merchant/4012791860
     * @param paySeq
     */
    void closeOrder(String paySeq);

}
